<!--
描述：设置直播课报名截止时间
开发人：zhaohang
开发日期：2019年11月20日
-->
<template lang="pug">
  kalix-dialog.user-add(title='报名截止时间' bizKey="liveExamine" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL" :submitBefore="submitBefore")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="报名截止时间" prop="overTime" v-bind:label-width="labelWidth")
        kalix-datetime-picker(v-model="formModel.overTime" type="date" :pickerOptions="pickerOptions")
</template>

<script type="text/ecmascript-6">
  import {liveURL} from '../../config.toml'
  import FormModel from './model'
  import KalixDatetimePicker from '../../../../../components/corelib/components/common/date/datetimepicker'
  export default {
    name: 'liveOver',
    components: {KalixDatetimePicker},
    data() {
      return {
        fileList: [],
        formModel: Object.assign({}, FormModel),
        labelWidth: '120px',
        targetURL: liveURL,
        pickerOptions: {
          disabledDate(time) {
            return time.getTime() <= Date.now()
          }
        }
      }
    },
    methods: {
      submitBefore(baseDialog, callBack) {
        if (baseDialog.formModel.appraise === '否') {
          this.formModel.appraise = false
        } else {
          this.formModel.appraise = true
        }
        if (baseDialog.formModel.isExamine === '待审核') {
          this.formModel.isExamine = 0
        }
        if (baseDialog.formModel.isExamine === '通过') {
          this.formModel.isExamine = 1
        }
        if (baseDialog.formModel.isExamine === '不通过') {
          this.formModel.isExamine = 2
        }
        if (baseDialog.formModel.isOpen === '待审核') {
          this.formModel.isOpen = 0
        }
        if (baseDialog.formModel.isOpen === '是') {
          this.formModel.isOpen = 1
        }
        if (baseDialog.formModel.isOpen === '否') {
          this.formModel.isOpen = 2
        }
        if (baseDialog.formModel.recommend === '是') {
          this.formModel.recommend = true
        }
        if (baseDialog.formModel.recommend === '否') {
          this.formModel.recommend = false
        }
        callBack()
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">

</style>
